package ch04.home;

class Exercise4_14 {
	public static void main(String[] args) {
		int answer = /* <1 */(int) (Math.random() * 100) + 1;/* 1> */
		int input = 0;
		int count = 0;

		java.util.Scanner s = new java.util.Scanner(System.in);

		do {
			count++;
			System.out.print("input positive number less than or equal to 100: ");
			input = s.nextInt();

			//<2
			if (input < answer)
				System.out.println("more.");
			else if (input > answer)
				System.out.println("less.");
			else {
				System.out.println("guess right.");
				System.out.println("try count: "+count);
				break;
			}
			//2>
		} while (true);
	}
}
/*
input positive number less than or equal to 100: 55
less.
input positive number less than or equal to 100: 40
less.
input positive number less than or equal to 100: 30
guess right.
try count: 3
*/
